package com.example.understand_compose1.fet_retrofitusage.data.api

import com.example.understand_compose1.fet_retrofitusage.data.model.Post
import org.w3c.dom.Comment
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.Field
import retrofit2.http.FieldMap
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.PATCH
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query
import retrofit2.http.QueryMap
import retrofit2.http.Url

interface IJsonPlaceholder {

    @get:GET("posts")
    val posts: Call<List<Any?>?>?

    @GET("posts")
    fun getPosts(@Query("userId") userId: Int): Call<List<Post?>?>?

    @GET("posts")
    fun getPosts(@Query("userId") userId: Int, @Query("_order") order: String?): Call<List<Post?>?>?

    @GET("posts")
    fun getPosts(@Query("userId") userId: Array<Int?>?): Call<List<Post?>?>?

    @GET("posts")
    fun getPosts(@QueryMap params: Map<String?, String?>?): Call<List<Post?>?>?

    @GET("posts/{id}/comments")
    fun getComments(@Path("id") postId: Int): Call<List<Comment?>?>?

    @GET
    fun getComments(@Url url: String?): Call<List<Comment?>?>?

    @POST("posts")
    fun createPost(@Body post: Post): Call<Post>

    @FormUrlEncoded
    @POST("posts")
    fun createPost(
        @Field("userId") userId: Int,
        @Field("title") title: String?,
        @Field("body") body: String?
    ): Call<Post?>?

    @FormUrlEncoded
    @POST("posts")
    fun createPost(@FieldMap fields: Map<String?, String?>?): Call<Post?>?

    @PUT("posts/{id}")
    fun putPost(@Path("id") id: Int, @Body post: Post?): Call<Post?>?

    @PATCH("posts/{id}")
    fun patchPost(@Path("id") id: Int, @Body post: Post?): Call<Post?>?

    @DELETE("posts/{id}")
    fun deletePost(@Path("id") id: Int): Call<Void?>?

    companion object

}